<br/>
<div style='float:right'>
  <%=link_to '[生成座次报表]',:controller=>'reporter',:action=>'group_photo_report',:id=>group_photo.id%>
  <a href="#" onclick="jQuery('#group_photos_by_<%=group_photo.id%>').hide('fold')">[隐藏这个区域]</a>
</div>
<br/>
<%group_photo.photo_rows.each do |photo_row|%>
  <fieldset id="pending_photo_row_<%=photo_row.id%>">
    <legend>第<%=photo_row.position%>排</legend>
    <ul class="horizontal" id="photo_row_<%=photo_row.id%>">
      <%photo_row.users.each do |user|%>
        <%=render :partial=>'group_photos/photo_row_user',:locals=>{:photo_row=>photo_row,:user=>user}%>
      <%end%>
    </ul>
  </fieldset>
  <%=drop_receiving_element("pending_photo_row_#{photo_row.id}",:accept=>'.pending_user',:with=>"'id='+ encodeURIComponent(($(ui.draggable).attr('id')).split('_').last()) + ';current_row=' + #{photo_row.id}+ ';row=' + encodeURIComponent(($(ui.draggable).attr('id')).split('_').first())",:url=>{:action=>'move_user'})%>
  <%=sortable_element "photo_row_#{photo_row.id}",:constraint=>'false',:overlap=>'horizontal',:url=>{:action=>"sort_row",:id=>photo_row.id}%>
  <br/>
  <div style='float:right'>
    <a href="#" onclick="Element.toggle('add_user_<%=photo_row%>');return false">添加人员</a>
  </div>
  <div id="add_user_<%=photo_row%>"  style='display:none'>
    <%remote_form_for :user,:url=>{:controller=>'group_photos',:action=>'add_user',:id=>"#{photo_row.id}"} do |f|%>
      根据<%=f.select :category,%w{部门 级别},{},{ "onchange" => remote_function(
                    :with => "'from='+value+';id='+#{group_photo.id}",
                    :update => "next_select_by_#{photo_row.id}",
                    :url => { :action => :select_with_ajax } ) }%>
      <span id="next_select_by_<%=photo_row.id%>"></span>
      <%=f.submit '确定'%>
    <%end%>
  </div>
  <br/>
<%end%>